﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MarketPlace.Data.DomainModels;
using System.ComponentModel;

namespace MarketPlace.Web.Controllers
{
    /// <summary>
    /// 市场行情
    /// </summary>
    public partial class MarketController : BaseController
    {
        //
        // GET: /Market/

        [OutputCache(Duration = 60, VaryByParam = "None")]
        public virtual ActionResult Index([DefaultValue(1)] int page, [DefaultValue(25)] int pagesize)
        {
            var qry = db.MarketInfo.Where(
                x =>

                   x.IsPublished == true

                ).OrderByDescending(x => x.Id);

            var data = GetPagedList<MarketInfo>(qry, page, pagesize);

            return View(data);
        }

        public ActionResult Details(long id)
        {
            var data = db.Session.Get<MarketInfo>(id);

            if (null == data)
            {
                return Message("没有找到市场信息！");
            }

            return View(data);
        }

    }
}
